#include <bits/stdc++.h>

using namespace std;
class Solution {
   public:
    vector<string> findRepeatedDnaSequences(string s) {
        vector<string> ans;
        unordered_map<string, int> m;
        for (int i = 0; i < (int)s.size() - 9; i++){
            string temp = s.substr(i, 10);
            m[temp]++;
            if (m[temp] == 2) ans.push_back(temp);
        }
        return ans;
    }
};